package com.tangguangdi.base.core.annotation;

import com.tangguangdi.base.common.annotation.Note;
import com.tangguangdi.base.common.annotation.Permission;
import com.tangguangdi.base.common.basic.PermissionRule;
import com.tangguangdi.base.common.basic.PermissionTimeFilter;
import org.springframework.core.annotation.AliasFor;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

import java.lang.annotation.*;

/**
 * get请求注解
 */
@Inherited
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.METHOD})
@RequestMapping(method = {RequestMethod.GET})
@Permission
public @interface GetApi {

    /**
     * 请求路径
     *
     * @return 默认为空
     */
    @AliasFor(annotation = RequestMapping.class)
    String[] path() default {};

    /**
     * 请求参数过滤
     *
     * @return 默认为空
     */
    @AliasFor(annotation = RequestMapping.class)
    String[] params() default {};

    /**
     * 头部参数过滤
     *
     * @return 默认为空
     */
    @AliasFor(annotation = RequestMapping.class)
    String[] headers() default {};

    /**
     * 请求体类型
     *
     * @return 默认为空
     */
    @AliasFor(annotation = RequestMapping.class)
    String[] consumes() default {};

    /**
     * 响应体类型
     *
     * @return 默认为空
     */
    @AliasFor(annotation = RequestMapping.class)
    String[] produces() default {};

    /**
     * 接口名称
     *
     * @return 默认为空
     */
    @AliasFor(annotation = Permission.class)
    String name() default "";

    /**
     * 鉴权规则
     *
     * @return 默认为登录
     */
    @AliasFor(annotation = Permission.class)
    PermissionRule rule() default PermissionRule.Login;

    /**
     * 时间过滤
     *
     * @return 默认为全天
     */
    @AliasFor(annotation = Permission.class)
    PermissionTimeFilter timeFilter() default PermissionTimeFilter.AllDay;

    /**
     * 时间设置
     *
     * @return 默认为空
     */
    @AliasFor(annotation = Permission.class)
    String timeSet() default "";

}
